import { useSelector, useDispatch } from "react-redux";
import { increment, decrement, addToNum } from "../store/modules/counterStore"

function App () {
  const { count } = useSelector(state => state.counter);
  const dispatch = useDispatch();
  return (
    <div>
      <button onClick={() => dispatch(increment())}>+</button>
      <h1>{count}</h1>
      <button onClick={() => dispatch(decrement())}>-</button>
      {/* 传参 */}
      <button onClick={() => dispatch(addToNum(10))}>+10</button>
    </div>
  )
}
export default App;